<?php
namespace Exam\Object;

use Tsy\Library\Object;
/**
 * Created by PhpStorm.
 * User: win10
 * Date: 2017/8/23
 * Time: 19:31
 */
/**
 *科目 KName 选填
 *考试批次 TBatch 选填
 *身份证号 NID 选填
 *姓名 UserName 选填
 *层次 CName 选填
 *专业 ZName 选填
 *分数 AllScore 不填
 */

class ScoreObject extends Object{

    function mSearch($TBatch='',$CName='',$ZName='',$KName='',$UserName='',$NID=''){
        if($TBatch!=null)
        {
            $condition=[
                'TBatch'=>$TBatch,
            ];
        }
        if($CName!=null)
        {
            $condition=[
                'CName'=>$CName,
            ];
        }
        if($NID!=null)
        {
            $condition=[
                'NID'=>$NID
            ];
        }
         if($ZName!=null)
         {
             $condition=[
                 'ZName'=>$ZName
             ];
         }
         if($KName!=null)
         {
             $condition=[
                 'KName'=>$KName
             ];
         }
         if($UserName!=null)
         {
             $condition=[
                 'UserNamae'=>$UserName
             ];
         }
        $data=M('score');
       $score=$data->where($condition)->field('TBatch,UserName,NID,CName,ZName,AllScore')->select();
       if($score!=null)
       {
           return $score;
       }
       else{
           return "没有查到相关成绩!";
       }
    }
}